<?php 
session_start();
require_once('CHorario.php');
$objHorario=new Persona();

$sw=false;

if($_POST['btnAccion']=="Ingresar")
  {
  	date_default_timezone_set('America/La_Paz');
 	 $hora = getdate(time());	
	 $date = date("d-m-Y");	
	$Fecha = implode( '-', array_reverse( explode( '-', $date ) ) ) ;
	$hor = ( $hora["hours"]. ":" . $hora["minutes"] . ":" . $hora["seconds"]);
	$des= $_POST['Descripcion'];
	if($des=="")
	{
		
		if($objHorario->GuardarHorario($_POST['idHorario'], $hor, $hora["hours"] , $hora["minutes"], $Fecha,null))
		{
			echo"<script>window.location='Correcto.php'</script>;";
		}
		else
		{
		  echo "<script>alert('Error al Guardar')</script>";
		}
	}
	else
	{
		if($objHorario->GuardarHorario($_POST['idHorario'], $hor, $hora["hours"] , $hora["minutes"], $Fecha,$des))
		{
		echo "<script>alert('Guardado Correctamente')</script>";	
		}
		else
		{
		  echo "<script>alert('Error al Guardar')</script>";
		}	
	}
  	
}
if($_POST['btnAccion']=="Volver")
  {	
  	session_destroy();
 	 echo"<script>window.location='FrmLogin.php'</script>;";	
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" ><head id="ctl00_Head1"><title>
	Control de Horario Lucy's Spa
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<style type="text/css" media="screen">
		body { margin:0; padding:0}
		</style>
		<script src="jquery-1.6.2.js" type="text/javascript"></script>
		
    <style type="text/css">
	input[type="submit"] {
     border-top: 1px solid #61e81e;
   background: #195913;
   background: -webkit-gradient(linear, left top, left bottom, from(#5beb2a), to(#195913));
   background: -moz-linear-gradient(top, #5beb2a, #195913);
   padding: 4.5px 9px;
   -webkit-border-radius: 6px;
   -moz-border-radius: 6px;
   border-radius: 6px;
   -webkit-box-shadow: rgba(0,0,0,1) 0 1px 0;
   -moz-box-shadow: rgba(0,0,0,1) 0 1px 0;
   box-shadow: rgba(0,0,0,1) 0 1px 0;
   text-shadow: rgba(0,0,0,.4) 0 1px 0;
   color: white;
   font-size: 11px;
   font-family: Georgia, Serif;
   text-decoration: none;
   vertical-align: middle;
   }
input[type="submit"]:hover {
   border-top-color: #8dfc91;
   background: #8dfc91;
   color: #140714;
   }
input[type="submit"]:active {
   border-top-color: #57fc2d;
   background: #57fc2d;
   }
    .Logueo
{
	width:260px;
	margin:auto;
	margin-top:15px;
	margin-bottom:15px;
	padding:0px 5px 0px 5px;
	text-align:right;
	font-family:Tahoma, Arial, Verdana;
	font-size:11px;
	background-color: transparent;
    border: 1px solid #000000;
	}
.Logueo p
{
	color:#666666;
	padding:3px 0px 3px 0px;
	margin:3px 0px 3px 0px;
	}
body {
	background-image: url(Imagenes/Spa3.jpg);
	background-repeat:no-repeat;
	
}
    </style>

</head>
<script type="text/javascript" src="jquery-1.2.1.pack.js"></script>
<script type="text/javascript" language="javascript">

function Limpiar()
{
	document.getElementById("Descripcion").value='';
}
 function validarPassword(){
 	if(document.getElementById('ckDes').checked==true)
		{
   			 texto = prompt("Para ver la página introduzca su contraseña");
   			 if(texto=="Jesus")
			 	{
				alert("Password Correcta");
				document.getElementById("Descripcion").style.visibility='visible';
				document.getElementById("Descripcion").style.display='';
				document.getElementById("Descripcion").value='Escriba el Motivo...';
				document.formulario.textarea16.disabled = false; 
				document.formulario.textarea16.disabled = focus();
   		 		}
				else
				{
					alert("Password incorrecta");			
				}
		}
	else
	{	
	  document.getElementById("Descripcion").style.visibility='hidden';
		document.getElementById("Descripcion").style.display='none';
		document.getElementById("Descripcion").value='';
		document.formulario.textarea16.value = ""; 
		document.formulario.textarea16.disabled = true; 
	}	
    
  }
function SugerirMateria(inputString) {
		if(inputString.length == 0) {
		document.getElementById("Image").style.visibility='visible';
document.getElementById("Image").style.display='';
			// Hide the suggestion box.
			$('#suggestions').hide();
		} else {
			$.post("SugImagen.php", {queryString: ""+inputString+""}, function(data){
				if(data.length >0) {
				document.getElementById("Image").style.visibility='hidden';
document.getElementById("Image").style.display='none';
					$('#suggestions').show();
					$('#autoSuggestionsList').html(data);
				}
			});
		}
	} // lookup
function qrdata(data) {
				
				$("#dataqr").html(data);
				SugerirMateria(document.getElementById("dataqr").innerHTML);
				document.getElementById("idHorario").value=document.getElementById("dataqr").innerHTML;
				}
	
var tick;
function stop() {
clearTimeout(tick);
}
function simple_reloj() {
var ut=new Date();
var h,m,s;
var time=" ";
h=ut.getHours();
m=ut.getMinutes();
s=ut.getSeconds();
if(s<=9) s="0"+s;
if(m<=9) m="0"+m;
if(h<=9) h="0"+h;
time+=h+":"+m+":"+s;
document.getElementById('reloj').innerHTML=time;
tick=setTimeout("simple_reloj()",1000); 
}
	
</script>
<body onLoad="simple_reloj();" onUnload="stop();">
 
<div class="Logueo">
		 <form id="form1" name="form1" method="POST" action="">
            <p style="text-align:center; color:#ffffff; border-bottom:solid 1px #FFFFFF; margin:3px 0px 5px 0px; padding:3px 0px 3px 0px"><b>Por favor ingrese su Codigo </b></p>
			 <!--
    Optionals flashvars
    stagesize:400
    spritegradienta:0xCCCCCC
    spritegradientb:0x999999
    lafuncion:qrdata
    -->
			<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="230" height="236" id="qrcode" align="middle">
				<param name="movie" value="qrcode.swf" />
				<param name="quality" value="high" />
				<param name="bgcolor" value="#ffffff" />
				<param name="play" value="true" />

				<param name="loop" value="true" />
				<param name="wmode" value="window" />
				<param name="scale" value="showall" />
				<param name="menu" value="true" />
				<param name="devicefont" value="false" />
				<param name="salign" value="" />
				<param name="allowScriptAccess" value="sameDomain" />
				<param name="FlashVars" value="stagesize=400&spritegradienta=0xCCCCCC&spritegradientb=0x999999" />
				<!--[if !IE]>-->

				<object type="application/x-shockwave-flash" data="qrcode.swf" width="230" height="236">
					<param name="movie" value="qrcode.swf" />
					<param name="FlashVars" value="stagesize=400&spritegradienta=0xCCCCCC&spritegradientb=0x999999" />
					<param name="quality" value="high" />
					<param name="bgcolor" value="#ffffff" />
					<param name="play" value="true" />
					<param name="loop" value="true" />
					<param name="wmode" value="window" />
					<param name="scale" value="showall" />

					<param name="menu" value="true" />
					<param name="devicefont" value="false" />
					<param name="salign" value="" />
					<param name="allowScriptAccess" value="sameDomain" />
				<!--<![endif]-->
					<a href="http://www.adobe.com/go/getflash">
						<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
					</a>
				<!--[if !IE]>-->

				</object>
				<!--<![endif]-->
			</object>
<br clear=all>
		<div id="dataqr" style="border:solid 1px #000;widh:100%;height:300px;overflow:scroll;visibility:hidden;display:none" ></div>
            <table>
			<tr >
				<p align="center"><b><font color="#FFFFFF" face="Forte" size="5">Hora Actual : <span id="reloj">reloj</span></font></b><font face="Forte">
</font>
			</tr>
            
			<tr>
			<td>
            <p align="center">
              <input name="idHorario" id="idHorario" type="text"  onblur="fill();" onkeypress="Hola()" style="visibility:hidden"/>
              <input id="ckDes" name="ckDes" type="checkbox" value="" onclick="validarPassword();" style="visibility:hidden"/></p>
			   
			   <textarea name="Descripcion"  id="Descripcion"  style="width:140px;visibility:hidden;display:none" onclick="Limpiar()"></textarea>		      </td>
			  <td>			
    <p>
	<div class="Image" id="Image" >
	<img src="Imagenes/Image.jpg" width="90" height="120" />	</div>
	 <div class="suggestionsBox" id="suggestions" style="display: none;">
				<div class="suggestionList" id="autoSuggestionsList">
&nbsp;				</div>
			</div></p>			  </td>
			  </tr>
			  </table>
            <p style="text-align:center; border-top:solid 1px #FFFFFF; margin:3px 0px 5px 0px; padding:3px 0px 3px 0px"><input type="submit"  name="btnAccion" id="btnAccion" value="Ingresar" /><input type="submit"  name="btnAccion" id="btnAccion" value="Volver" /></p>
</form>
        </div>
	
      
   
          

               
</div>
</form>
</body>
</html>
